package com.insnow.knowshare.repository;

import com.insnow.knowshare.entity.Reply;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.time.LocalDateTime;
import java.util.List;

public interface ReplyRepository extends JpaRepository<Reply, Long> {
    
    @Query("SELECT r.userId, COUNT(r) FROM Reply r WHERE r.createdAt BETWEEN :start AND :end GROUP BY r.userId")
    List<Object[]> countRepliesByUser(@Param("start") LocalDateTime start, @Param("end") LocalDateTime end);
}
